<?php
    require_once("./classes/sessao.php");
    require_once("./classes/interfaces.php");
    require_once("./classes/conexao.php");

    session_start();
    if (!isset($_SESSION['ANAWEB']) || $_SESSION['ANAWEB']->RetornaIdioma() == "PT_BR")
    {
        $msg = new Traducao("/home/projetos/anaweb/anaweb-new/linguas/linguas.xml", "pt-br");
    }
    else
    {
        $msg = new Traducao("/home/projetos/anaweb/anaweb-new/linguas/linguas.xml", "en-us");
    }
    if (!isset($_SESSION['ANAWEB']))
    {
        $pagina = new Interfaces();
        $pagina->Header(Nao_Logado);
        $pagina->Body();
        echo Nao_Logado_Msg;
        $pagina->Footer();
    }
    else
    {
        $pagina = new Interfaces();
        $pagina->Header(" ANAWEB ");
        $pagina->Body();
        if (isset($_GET['cat']) && isset($_GET['file']))
        {
            $arq = base64_decode($_GET['file']);
            $xml = DOMDocument::load($arq);
?>
            <h1><?php echo $msg->get('Novo_Item') ?></h1>
            <div id="cadastro">
            <form name="formhelp" enctype="multipart/form-data" action="arv_create.php?file=<?php echo $_GET['file'] ?>" method="post">
            <fieldset>
            <legend><?php echo $msg->get('Item') ?></legend>
            <p><label for="itname"><?php echo $msg->get('Nome_Item') ?>:</label> <input type="text" name="nome" id="itname"></p>
            <p><label for="desc"><?php echo $msg->get('Descricao') ?>:</label> <textarea name="desc" id="desc" cols="40" rows="1"></textarea></p>
            <p><label for="relcom"><?php echo $msg->get('Comando_Relacionado') ?>:</label> <input type="text" name="relcom" id="relcom"></p>
            </fieldset>
            <fieldset>
            <legend><?php echo $msg->get('Tente_Voce_Mesmo') ?></legend>
            <p><label for="templ"><?php echo $msg->get('Template') ?>:</label> <input type="text" name="templ" id="templ"></p>
            <p><label for="remarktry"><?php echo $msg->get('Comentario') ?>:</label> <textarea name="comentarios" id="remarktry" cols="40" rows="1"></textarea></p>
            </fieldset>
            <fieldset>
            <legend><?php echo $msg->get('Exemplo') ?></legend>
            <p><label for="com"><?php echo $msg->get('Comandos') ?>:</label> <textarea name="comandos" id="com" cols="40" rows="7" wrap="off"></textarea></p>
            <p><label for="remarkcom"><?php echo $msg->get('Comentario') ?>:</label> <textarea name="comentarioscom" id="remarkcom" cols="40" rows="1"></textarea></p>
            </fieldset>
            <fieldset>
            <legend><?php echo $msg->get('Exercicio') ?></legend>
            <p><label for="ex"><?php echo $msg->get('Exercicio') ?>:</label> <textarea name="exercicio" id="ex" cols="40" rows="1"></textarea></p>
            <p><label for="dica"><?php echo $msg->get('Dica') ?>:</label> <textarea name="dica" id="dica" cols="40" rows="1"></textarea></p>
            <p><label for="solucao"><?php echo $msg->get('Solucao') ?>:</label> <textarea name="solucao" id="solucao" cols="40" rows="1"></textarea></p>
            </fieldset>
            <fieldset>
            <legend><?php echo $msg->get('Arquivo_Ajuda') ?></legend>
<?php
    if ($arq == "./bibliotecas/scilab_valid.xml")
    {
?>
        <script type="text/javascript" src="./javascript/helpscilab.php"></script>
        <p><label for="topico"><?php echo $msg->get('Topico') ?>:</label>
        <select name="topico" id="topico" onchange="mudatopico(document.formhelp.topico)">>
            <option value="0">Programming</option>
            <option value="1">Graphics Library</option>
            <option value="2">Elementary Functions</option>
            <option value="3">Input/Output Functions</option>
            <option value="4">Handling of functions and libraries</option>
            <option value="5">Character string manipulations</option>
            <option value="6">GUI and Dialogs</option>
            <option value="7">Utilities</option>
            <option value="8">Linear Algebra</option>
            <option value="9">Polynomial calculations</option>
            <option value="10">General System and Control</option>
            <option value="11">Robust control toolbox</option>
            <option value="12">Optimization and simulation</option>
            <option value="13">Signal Processing toolbox</option>
            <option value="14">Arma modelisation and simulation toolbox</option>
            <option value="15">Metanet: graph and network toolbox</option>
            <option value="16">Scicos: Bloc diagram editor and simulator</option>
            <option value="17">Sound file handling</option>
            <option value="18">Language or data translations</option>
            <option value="19">TdCs</option>
            <option value="20">Statistic basics</option>
            <option value="21">Cumulative Distribution Functions; Inverses, grand</option>
            <option value="22">Identification</option>
            <option value="23">Matlab to Scilab converstion tips</option>
            <option value="24">Sparse solvers</option>
            <option value="25">PVM parallel toolbox</option>
            <option value="26">TCL/Tk interface</option>
            <option value="27">Java interface</option>
            <option value="nada" selected>---</option>
        </select></p>
        <p><label for="subtopico"><?php echo $msg->get('Comando') ?>:</label>
        <select name="subtopico">
            <option>--</option>
        </select></p>
<?php
    } else {
?>
            <p><label for="arq"><?php echo $msg->get('Comando') ?>:</label> <input type="text" name="ajuda" id="arq"></p>
<?php
    }
?>
            </fieldset>
            <input type="hidden" name="cat" value="<?php echo $_GET['cat'] ?>">
            <input type="submit" value="<?php echo $msg->get('Enviar') ?>">
            </form>
            </div>
<?php
        }
        $pagina->Footer();
    }
?> 

